import { IsString, IsJSON, IsEnum, IsPhoneNumber, IsArray, Min, Length, IsOptional, IsBoolean, IsNumber, IsNumberString, IsEmail, IsDateString } from 'class-validator';
import { ApiProperty, PartialType } from '@nestjs/swagger';
import { PagingDto } from 'src/common/dto/index';

export enum StatusEnum {
  STATIC = '0',
  DYNAMIC = '1',
  DELETED = '2'
}

export class CreateRoleDto {
    @ApiProperty({ required: true })
    @Length(0,50)
    roleid: string; 
  
    @ApiProperty({ required: false })
    @IsOptional()
    // @IsEmail()
    @Length(0, 50)
    rolename: string;

    @ApiProperty({ required: false })
    @IsOptional()
    // @IsEmail()
    @Length(0, 50)
    rolekey: string;
  
  
    @ApiProperty({ required: false })
    @IsOptional()
    @IsString()
    @IsEnum(StatusEnum)
    status?: string;
  
    @ApiProperty({ required: false })
    @IsOptional()
    @IsString()
    @Length(0, 500)
    remark?: string;
  
    @ApiProperty({ required: true })
    @IsOptional()
    @IsDateString()
    create_time?: string;
  
    
  }

  export class UpdateRoleDto extends PartialType(CreateRoleDto) {
    @ApiProperty({ required: true })
    @IsOptional()
    @IsDateString()
    update_time?: string;
  }

  export class ListRoleDto extends PagingDto {
    @ApiProperty({ required: false })
    @IsOptional()
    @IsString()
    @Length(0, 30)
    rolename?: string;
  
    @ApiProperty({ required: false })
    @IsOptional()
    @IsString()
    @Length(0, 30)
    rolekey?: string;
  
    @ApiProperty({ required: false })
    @IsOptional()
    @IsString()
    @Length(0, 50)
    roleid?: string;
  
    @ApiProperty({ required: false })
    @IsOptional()
    @IsString()
    remark?: string;

    @ApiProperty({ required: true })
    @IsOptional()
    @IsDateString()
    create_time?: string;

    @ApiProperty({ required: true })
    @IsOptional()
    @IsDateString()
    update_time?: string;
  
    @ApiProperty({ required: false })
    @IsOptional()
    @IsString()
    @IsEnum(StatusEnum)
    status?: string;
  }